<?php
// Step 6 of web-cp setup
//   Web-cp module configuration - e.g. Apache VHost Module, Quota Module

?>
<!--BEGIN HTML-->
<!--<input type=hidden name="step" value="6">-->
<!-- MODULE SELECTION CONFIGURATION -->
<div align="center">
<table border="0" cellpadding="0" cellspacing="0"><tr><td>
<table border="0" cellpadding="0" cellspacing="0" class="tblbg"><tr><td>
<table border="0" cellspacing="1" width="400">
	<tr>
		<td class="tbltop" colspan="5">Select Modules</td>
	</tr>
<?php
	// Find modules
	$modules = dir_list($cfg['basedir'].'/modules/', 'file');

	foreach($modules as $modname) {
		$modnamearry = explode('/', $modname);
		$modname = $modnamearry[sizeof($modnamearry) - 1];
		if ($modname != '' && stristr($modname, '.mod.phps')) {
			unset($module);
			// Replace module file name with module definition file name
			$module_def = str_replace('.mod.phps', '.def.phps', $modname);

			// Set action so that nothing happens.
			$action = '';

			// Include module definition file
			include($cfg['basedir'].'/modules/'.$module_def);
?>
			<div id="<?php echo $modname; ?>" class="popup">
				<b><?php echo $module['name']; ?></b><br>
				Description: <?php echo $module['description']; ?><br>
				<?php if (is_array($module['depends'])) echo "Dependencies: <i>".implode(', ', $module['depends']).".</i><br>"; ?>
				<?php if (is_array($module['excludes'])) echo "Exclusions: <i>".implode(', ', $module['excludes'])."</i>."; ?>
			</div>
			<tr>
				<td class="row1" align="right"><b><?php echo $module['name']; ?></b>&nbsp;</td>
				<td class="row2" align="left">&nbsp;<input type="checkbox" name="data[<?php echo $modname; ?>]" value="true" checked></td>
				<td class="row2"><img src="/icon/question.png" width="24" height="24" onmouseover="popup(event,'<?php echo $modname; ?>')" onmouseout="popup(event,'<?php echo $modname; ?>')"></td>
			</tr>
<?php
		}
	}
?>
</table>
</td></tr></table><br>
<?	if ($nosubmit == true) { ?>
			<input type="hidden" name="data[modulesselected]" value="false">
<?	} else { ?>
			<input type="hidden" name="data[modulesselected]" value="true">
<?	}	?>
<!--END HTML-->
